package org.rsbot.event.impl;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import org.rsbot.bot.Bot;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.Inventory;
import org.rsbot.script.methods.MethodContext;
import org.rsbot.script.wrappers.RSComponent;
import org.rsbot.script.wrappers.RSItem;

public class DrawInventory
  implements PaintListener
{
  private MethodContext ctx;

  public DrawInventory(Bot paramBot)
  {
    this.ctx = paramBot.getMethodContext();
  }

  public void onRepaint(Graphics paramGraphics) {
    if (!this.ctx.game.isLoggedIn()) {
      return;
    }
    if (this.ctx.game.getCurrentTab() != 4) {
      return;
    }
    paramGraphics.setColor(Color.WHITE);
    RSItem[] arrayOfRSItem = this.ctx.inventory.getItems();

    for (int i = 0; i < arrayOfRSItem.length; i++)
      if (arrayOfRSItem[i].getID() != -1) {
        Point localPoint = arrayOfRSItem[i].getComponent().getCenter();
        paramGraphics.drawString("" + arrayOfRSItem[i].getID(), localPoint.x, localPoint.y);
      }
  }
}